package cn.tjjcy.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Configuration
public class ThreadPoolConfig {


    @Value("${oct.thread.pool.size:2}")
    private Integer threadPoolSize;


    @Primary
    @Bean(value = "taskExecutor")
    public ExecutorService taskExecutor() {
         ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize);
        return executorService;
    }
}
